package com.example.task.dao;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.task.entity.Goods;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

public interface GoodsDao extends BaseMapper<Goods> {
    @Update("update t_goods set stock=stock-#{num} where id=#{id} and stock>=#{num}")
    int updateStock(@Param("id")long id,@Param("num") int num);
}
